<%@ page import="static com.test.ws.s1.utils.Res.fileUrl" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>用户管理</title>
    <style>
        /* 基础表格样式 */
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }
        th, td {
            border: 1px solid #ddd;
            padding: 12px;
            text-align: center;
        }
        th {
            background-color: #4CAF50;
            color: white;
            font-weight: bold;
        }
        tr:nth-child(even) {
            background-color: #f2f2f2;
        }
        tr:hover {
            background-color: #e9e9e9;
        }

        /* 头像样式 */
        .avatar-circle {
            border-radius: 50%;
            width: 50px;
            height: 50px;
            object-fit: cover;
            border: 2px solid #ddd;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            transition: transform 0.3s;
        }
        .avatar-circle:hover {
            transform: scale(1.1);
        }

        /* 搜索栏样式 */
        .search-bar {
            background: #f8f9fa;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            margin: 20px 0;
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            align-items: center;
        }
        .search-input {
            flex: 1;
            min-width: 200px;
            border: 2px solid #dee2e6;
            border-radius: 25px;
            padding: 10px 20px;
            font-size: 14px;
            transition: all 0.3s;
        }
        .search-input:focus {
            border-color: #4CAF50;
            box-shadow: 0 0 0 0.2rem rgba(76, 175, 80, 0.25);
        }
        .search-btn {
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 25px;
            padding: 10px 25px;
            cursor: pointer;
            font-weight: 500;
            transition: all 0.3s;
        }
        .search-btn:hover {
            background-color: #45a049;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        .reset-btn {
            background-color: #f44336;
            color: white;
            border: none;
            border-radius: 25px;
            padding: 10px 25px;
            cursor: pointer;
            font-weight: 500;
            transition: all 0.3s;
            text-decoration: none;
            display: inline-block;
        }
        .reset-btn:hover {
            background-color: #d32f2f;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }

        /* 操作按钮 */
        .action-btn {
            padding: 6px 12px;
            margin: 0 5px;
            border-radius: 4px;
            text-decoration: none;
            color: white;
            font-size: 14px;
            transition: all 0.3s;
        }
        .edit-btn {
            background-color: #2196F3;
        }
        .edit-btn:hover {
            background-color: #0b7dda;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }
        .delete-btn {
            background-color: #f44336;
        }
        .delete-btn:hover {
            background-color: #d32f2f;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }
        .add-btn {
            display: inline-block;
            background-color: #4CAF50;
            color: white;
            padding: 10px 20px;
            border-radius: 4px;
            text-decoration: none;
            margin-top: 20px;
            transition: all 0.3s;
        }
        .add-btn:hover {
            background-color: #45a049;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }

        /* 分页样式 */
        .pagination-container {
            margin: 30px 0;
            display: flex;
            justify-content: center;
        }
        .pagination {
            display: flex;
            gap: 5px;
            list-style: none;
            padding: 0;
        }
        .page-item {
            margin: 0;
        }
        .page-link {
            padding: 8px 16px;
            border: 1px solid #ddd;
            border-radius: 4px;
            color: #4CAF50;
            text-decoration: none;
            transition: all 0.3s;
        }
        .page-item.active .page-link {
            background: #4CAF50;
            color: white;
            border-color: #4CAF50;
        }
        .page-link:hover:not(.active) {
            background: #f1f1f1;
        }
        .page-item.disabled .page-link {
            color: #ccc;
            pointer-events: none;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            table, thead, tbody, th, td, tr {
                display: block;
            }
            thead tr {
                position: absolute;
                top: -9999px;
                left: -9999px;
            }
            tr {
                margin-bottom: 15px;
                border: 1px solid #ddd;
                border-radius: 5px;
            }
            td {
                border: none;
                border-bottom: 1px solid #eee;
                position: relative;
                padding-left: 50%;
                text-align: right;
            }
            td:before {
                content: attr(data-label);
                position: absolute;
                left: 10px;
                width: 45%;
                padding-right: 10px;
                font-weight: bold;
                text-align: left;
            }
            .search-bar {
                flex-direction: column;
                align-items: stretch;
            }
            .search-input, .search-btn, .reset-btn {
                width: 100%;
                margin-bottom: 10px;
            }
        }


        /*分页*/
        .pagination {
            display: flex;
            gap: 8px;
            padding: 15px 0;
        }

        .pagination a {
            padding: 8px 16px;
            border: 1px solid #4CAF50;
            border-radius: 4px;
            text-decoration: none;
            color: #4CAF50;
            transition: all 0.3s;
        }

        .pagination a.current {
            background: #4CAF50;
            color: white;
            border-color: #4CAF50;
        }

        .pagination a:hover:not(.current) {
            background: #f1f1f1;
        }

        /*!* 表单布局 *!*/
        /*.form-row {*/
        /*    display: flex;*/
        /*    gap: 20px;*/
        /*    margin-bottom: 15px;*/
        /*}*/

        /*.form-group {*/
        /*    flex: 1;*/
        /*}*/

        /*.form-footer {*/
        /*    text-align: right;*/
        /*    margin-top: 20px;*/
        /*}*/


        /* 网格布局调整为5列 */
        .form-row {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 12px;
            margin-bottom: 15px;
        }

        /* 下拉菜单增强样式 */
        select.form-input {
            appearance: none;
            background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%234CAF50"><path d="M7 10l5 5 5-5z"/></svg>')
            no-repeat right 12px center/12px;
            padding-right: 32px;
        }

        /* 响应式调整 */
        @media (max-width: 1200px) {
            .form-row {
                grid-template-columns: repeat(3, 1fr);
            }
        }

        @media (max-width: 992px) {
            .form-row {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 768px) {
            .form-row {
                grid-template-columns: 1fr;
            }
            select.form-input {
                background-size: 10px;
                padding-right: 28px;
            }
        }

    /*111*/
        /* 修改搜索栏容器圆角 */
        .search-bar {
            border-radius: 20px;  /* 原为8px */
            overflow: hidden;     /* 新增隐藏内部元素溢出 */
        }

        /* 调整搜索按钮圆角 */
        .btn-search,
        .btn-reset {
            border-radius: 15px;  /* 原为25px */
        }

        /* 调整输入框圆角 */
        .form-input {
            border-radius: 12px;  /* 原为25px */
            padding: 12px 20px;   /* 增大内边距 */
        }

        /* 适配移动端 */
        @media (max-width: 768px) {
            .search-bar {
                border-radius: 15px;
            }

            .form-input {
                border-radius: 8px;
            }
        }


        /* 在现有样式基础上修改以下内容 */

        .btn-search,
        .btn-reset {
            /* 基础样式 */
            position: relative;
            overflow: hidden;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            font-weight: 600;
            letter-spacing: 0.8px;
            padding: 14px 32px;
            border: none;

            /* 新增样式 */
            background-image: linear-gradient(
                    135deg,
                    rgba(255,255,255,0.15) 0%,
                    transparent 50%,
                    rgba(0,0,0,0.05) 100%
            );
            box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1),
            0 2px 4px -1px rgba(0,0,0,0.06);
        }

    </style>
</head>
<body>
<h2 style="color: #4CAF50; text-align: center; margin-top: 20px;">旅游路线管理</h2>

<!-- 搜索栏 -->
<!-- 修改后的搜索栏结构 -->
<div class="search-bar">
    <form action="${pageContext.request.contextPath}/routeCha" method="post" class="search-form">
        <!-- 第一行（5列布局） -->
        <div class="form-row">
            <div class="form-group">
                <label>线路编号：</label>
                <input type="number" name="route_id" class="form-input"
                       placeholder="精确编号" value="${param.route_id}">
            </div>
            <div class="form-group">
                <label>线路名称：</label>
                <input type="text" name="route_name" class="form-input"
                       placeholder="模糊查询" value="${param.route_name}">
            </div>
            <div class="form-group">
                <label>出发地：</label>
                <input type="text" name="route_star" class="form-input"
                       placeholder="出发城市" value="${param.route_star}">
            </div>
            <div class="form-group">
                <label>目的地：</label>
                <input type="text" name="route_end" class="form-input"
                       placeholder="目标城市" value="${param.route_end}">
            </div>

            <div class="form-group">
                <label>行程天数：</label>
                <input type="number" name="route_days" class="form-input"
                       placeholder="精确天数" min="1" value="${param.route_days}">
            </div>
        </div>

        <!-- 第二行（5列布局） -->
        <div class="form-row">
            <div class="form-group">
                <label>最低价格：</label>
                <input type="number" name="route_price" class="form-input"
                       placeholder="最低价格" min="0" value="${param.route_price}">
            </div>
            <div class="form-group">
                <label>栏目分类：</label>
                <select name="cla_id" class="form-input">
                    <option value="">全部分类</option>
                    <c:forEach items="${classIfs}" var="c">
                        <option value="${c.classif_id}"
                            ${param.cla_id == c.classif_id ? 'selected' : ''}>
                                ${c.classif_name}
                        </option>
                    </c:forEach>
                </select>
            </div>
            <div class="form-group">
                <label>热点状态：</label>
                <select name="route_on" class="form-input">
                    <option value="">全部</option>
                    <option value="1" ${param.route_on == '1' ? 'selected' : ''}>是热点</option>
                    <option value="0" ${param.route_on == '0' ? 'selected' : ''}>非热点</option>
                </select>
            </div>
<%--            <div class="form-group">--%>
<%--                <label>显示已删除：</label>--%>
<%--                <select name="deletes" class="form-input">--%>
<%--                    <option value="0" ${param.deletes == '0' ? 'selected' : ''}>仅有效</option>--%>
<%--                    <option value="1" ${param.deletes == '1' ? 'selected' : ''}>含删除</option>--%>
<%--                </select>--%>
<%--            </div>--%>
            <div class="form-group">
                <label>供应商：</label>
                <select name="gy_id" class="form-input">
                    <option value="">全部供应商</option>
                    <c:forEach items="${suppliers}" var="s">
                        <option value="${s.supplier_id}"
                            ${param.gy_id == s.supplier_id ? 'selected' : ''}>
                                ${s.supplier_name}
                        </option>
                    </c:forEach>
                </select>
            </div>
        </div>

        <!-- 按钮行 -->
        <div class="form-footer">
            <button type="submit" class="btn-search">搜索</button>
            <a href="${pageContext.request.contextPath}/routeCha" class="btn-reset">重置</a>
        </div>
    </form>
</div>



<!-- 用户表格 -->
<table>
    <thead>
    <tr>
        <th>编号</th>
        <th>路线名称</th>
        <th>出发地</th>
        <th>目的地</th>
        <th>价格</th>
        <th>行程天数</th>
        <th>是否为热点</th>
<%--        <th>线路介绍</th>--%>
        <th>线路图片</th>
        <th>状态</th>
        <th>分类栏目</th>
        <th>供应商</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach var="user" items="${routeCha}">
        <tr>
            <td data-label="编号">${user.route_id}</td>
            <td data-label="路线名称">${user.route_name}</td>
            <td data-label="出发地">${user.route_star}</td>
            <td data-label="目的地">${user.route_end}</td>
            <td data-label="价格">${user.route_price}</td>
            <td data-label="行程天数">${user.route_days}</td>
            <td data-label="是否为热点">${user.route_on}</td>
<%--            <td data-label="线路介绍">${user.route_js}</td>--%>
            <td data-label="线路图片">
                <img src="<%=fileUrl%>${user.route_img}" alt="线路图片" style="max-width: 100px; max-height: 100px;">
            </td>
            <td data-label="状态">${user.deletes}</td>
            <td data-label="分类栏目">${user.classIf.classif_name}</td>
            <td data-label="供应商">${user.supplier.supplier_name}</td>
            <td data-label="操作">
                <a href="${pageContext.request.contextPath}/selectRouteOne?id=${user.route_id}" class="action-btn edit-btn">编辑</a>
                <a href="${pageContext.request.contextPath}/updateRouteLunBo?id=${user.route_id}" class="action-btn edit-btn">设为轮播</a>
                <a href="${pageContext.request.contextPath}/updateRouteLunBoWei?id=${user.route_id}" class="action-btn edit-btn">禁用轮播</a>
                <a href="${pageContext.request.contextPath}/routeFuTu?id=${user.route_id}" class="action-btn edit-btn">增加附图</a>
                <a href="${pageContext.request.contextPath}/imgsCha?id=${user.route_id}" class="action-btn edit-btn">查看附图</a>
                <a href="${pageContext.request.contextPath}/deleteRouteWei?id=${user.route_id}"
                   class="action-btn delete-btn"
                   onclick="return confirm('确认删除用户 ${user.route_name} 吗？')">删除</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<!-- 添加用户按钮 -->
<div style="text-align: center;">
    <a href="${pageContext.request.contextPath}/routeAdd" class="add-btn">添加新路线</a>
</div>

<div class="pagination">
    <c:if test="${pageInfo.hasPreviousPage}">
        <a href="routeCha?pageNum=1&route_id=${param.route_id}&route_name=${param.route_name}&route_star=${param.route_star}&route_end=${param.route_end}&route_price=${param.route_price}&route_days=${param.route_days}&route_on=${param.route_on}&route_js=${param.route_js}&deletes=${param.deletes}&classIf.classif_name=${param.classIf.classif_name}&supplier.supplier_name=${param.supplier.supplier_name}">首页</a>
        <a href="routeCha?pageNum=${pageInfo.pageNum-1}&route_id=${param.route_id}&route_name=${param.route_name}&route_star=${param.route_star}&route_end=${param.route_end}&route_price=${param.route_price}&route_days=${param.route_days}&route_on=${param.route_on}&route_js=${param.route_js}&deletes=${param.deletes}&classIf.classif_name=${param.classIf.classif_name}&supplier.supplier_name=${param.supplier.supplier_name}">上一页</a>
    </c:if>

    <c:forEach begin="1" end="${pageInfo.pages}" var="pn">
        <a href="routeCha?pageNum=${pn}&route_id=${param.route_id}&route_name=${param.route_name}&route_star=${param.route_star}&route_end=${param.route_end}&route_price=${param.route_price}&route_days=${param.route_days}&route_on=${param.route_on}&route_js=${param.route_js}&deletes=${param.deletes}&classIf.classif_name=${param.classIf.classif_name}&supplier.supplier_name=${param.supplier.supplier_name}"
           <c:if test="${pn == pageInfo.pageNum}">class="current"</c:if>
        >${pn}</a>
    </c:forEach>

    <c:if test="${pageInfo.hasNextPage}">
        <a href="routeCha?pageNum=${pageInfo.pageNum+1}&route_id=${param.route_id}&route_name=${param.route_name}&route_star=${param.route_star}&route_end=${param.route_end}&route_price=${param.route_price}&route_days=${param.route_days}&route_on=${param.route_on}&route_js=${param.route_js}&deletes=${param.deletes}&classIf.classif_name=${param.classIf.classif_name}&supplier.supplier_name=${param.supplier.supplier_name}">下一页</a>
        <a href="routeCha?pageNum=${pageInfo.pages}&route_id=${param.route_id}&route_name=${param.route_name}&route_star=${param.route_star}&route_end=${param.route_end}&route_price=${param.route_price}&route_days=${param.route_days}&route_on=${param.route_on}&route_js=${param.route_js}&deletes=${param.deletes}&classIf.classif_name=${param.classIf.classif_name}&supplier.supplier_name=${param.supplier.supplier_name}">末页</a>
    </c:if>
</div>



</body>
</html>